﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PRC_TB_ALERTS_DE')
	BEGIN
		DROP  Procedure  dbo.PRC_TB_ALERTS_DE
	END

GO

CREATE Procedure dbo.PRC_TB_ALERTS_DE
	(
		@TA_ID int
	)

AS

begin transaction

	exec PRC_TB_ALERTS_CLEAN_REFERENCES @TA_ID
	
	delete TB_ALERTS where TA_ID = @TA_ID
	
if @@error <> 0
	begin
		rollback
	end
else
	begin
		commit
	end

GO

GRANT EXEC ON dbo.PRC_TB_ALERTS_DE TO PUBLIC

GO

